home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / ParsePosition.java < prev    next >
Text File  |  1998-09-22  |  3KB  |  84 lines

  1. /*
  2.  * @(#)ParsePosition.java    1.6 97/02/06
  3.  *
  4.  * (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
  5.  * (C) Copyright IBM Corp. 1996 - All Rights Reserved
  6.  *
  7.  * Portions copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
  8.  *
  9.  *   The original version of this source code and documentation is copyrighted
  10.  * and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
  11.  * materials are provided under terms of a License Agreement between Taligent
  12.  * and Sun. This technology is protected by multiple US and International
  13.  * patents. This notice and attribution to Taligent may not be removed.
  14.  *   Taligent is a registered trademark of Taligent, Inc.
  15.  *
  16.  * Permission to use, copy, modify, and distribute this software
  17.  * and its documentation for NON-COMMERCIAL purposes and without
  18.  * fee is hereby granted provided that this copyright notice
  19.  * appears in all copies. Please refer to the file "copyright.html"
  20.  * for further important copyright and licensing information.
  21.  *
  22.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  23.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  24.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  25.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  26.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  27.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  28.  *
  29.  */
  30.  
  31. package java.text;
  32.  
  33.  
  34. /**
  35.  * <code>ParsePosition</code> is a simple class used by <code>Format</code>
  36.  * and its subclasses to keep track of the current position during parsing.
  37.  * The <code>parseObject</code> method in the various <code>Format</code>
  38.  * classes requires a <code>ParsePosition</code> object as an argument.
  39.  *
  40.  * <p> 
  41.  * By design, as you parse through a string with different formats,
  42.  * you can use the same <code>ParsePosition</code>, since the index parameter
  43.  * records the current position.
  44.  *
  45.  * @version     1.6 02/06/97
  46.  * @author      Mark Davis
  47.  * @see         java.util.Format
  48.  */
  49.  
  50. public class ParsePosition {
  51.  
  52.     /**
  53.      * Input: the place you start parsing.
  54.      * <br>Output: position where the parse stopped.
  55.      * This is designed to be used serially,
  56.      * with each call setting index up for the next one.
  57.      */
  58.     int index = 0;
  59.  
  60.     /**
  61.      * Retrieve the current parse position.  On input to a parse method, this
  62.      * is the index of the character at which parsing will begin; on output, it
  63.      * is the index of the character following the last character parsed.
  64.      */
  65.     public int getIndex() {
  66.     return index;
  67.     }
  68.  
  69.     /**
  70.      * Set the current parse position.
  71.      */
  72.     public void setIndex(int index) {
  73.     this.index = index;
  74.     }
  75.  
  76.     /**
  77.      * Create a new ParsePosition with the given initial index.
  78.      */
  79.     public ParsePosition(int index) {
  80.         this.index = index;
  81.     }
  82.  
  83. }
  84.